#!/usr/bin/make -f

build: clean build-stamp libraries binary post-clean

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp
	dh_clean

build-stamp:
	touch build-stamp

libraries:
	cp ../../../Trunk/org/schimpf/sql/base/SQLAdvanceds.interface.php5 debian/input/
	cp ../../../Trunk/org/schimpf/sql/base/SQLBasics.interface.php5 debian/input/
	cp ../../../Trunk/org/schimpf/sql/base/SQLFilters.interface.php5 debian/input/
	cp ../../../Trunk/org/schimpf/sql/base/SQLTransactions.interface.php5 debian/input/
	cp ../../../Trunk/org/schimpf/sql/base/SQLWrapper.interface.php5 debian/input/
	cp ../../../Trunk/org/schimpf/sql/mysql/MySQLAdvanced.class.php5 debian/input/
	cp ../../../Trunk/org/schimpf/sql/mysql/MySQLAssistant.class.php5 debian/input/
	cp ../../../Trunk/org/schimpf/sql/mysql/MySQLLink.class.php5 debian/input/
	cp ../../../Trunk/org/schimpf/sql/mysql/MySQLProcess.class.php5 debian/input/
	cp ../../../Trunk/org/schimpf/sql/pgsql/PSQLAssistant.class.php5 debian/input/
	cp ../../../Trunk/org/schimpf/sql/pgsql/PSQLLink.class.php5 debian/input/
	cp ../../../Trunk/org/schimpf/sql/pgsql/PSQLProcess.class.php5 debian/input/

binary:
	dh_testdir
	dh_testroot
	dh_prep
	dh_install
	dh_installchangelogs
	dh_icons
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

post-clean:
	dh_clean
	rm -f build-stamp
	rm -Rf debian/input/*
	mkdir -p ../../builds/1.0.0
	mkdir -p ../../builds/current
	mv ../libschimpf-sql-php5_1.0.0_all.deb ../../builds/1.0.0/libschimpf-sql-php5_1.0.0_all.deb
	rm -f ../../builds/current/libschimpf-sql-php5_current_all.deb
	ln -s "`dirname ../../builds/1.0.0/libschimpf-sql-php5_1.0.0_all.deb`"/libschimpf-sql-php5_1.0.0_all.deb ../../builds/current/libschimpf-sql-php5_current_all.deb
	chown hschimpf:root -R ../../builds